import numpy
from listnode import ListNode
from typing import Optional,Tuple,List

def getDist(node1: numpy.array, node2: numpy.array) -> int:
    ans: int = 0
    for row, list_elem in enumerate(node1):
        for col, elem in enumerate(list_elem):
            if node2[row][col] != elem:
                ans += 1
    return ans

def getInversionCount(nums: numpy.array) -> int:
    nums = nums.copy().reshape(nums.shape[0] * nums.shape[1])
    inv_count = 0
    for i in range(1,8):
        for j in range(i+1,9):
            if nums[j] and nums[i] and (nums[i] > nums[j] ):
                inv_count +=1
    return inv_count
